code refactor. Wrap functions in object