first problem done and refactored