Added solutions and refactored