refactored functions into pretty objects