finalized every problem and refactoring done