finished exercises and refactored code based on notes