refactored( placed the functions inside the objects )