how to add prototype to a function