finished all required features and refactored some code