encapsulating functions in object