Added return object for function. Added appropriate test methods.