added code for prototype chaining