Defining functions in a object like way