Finish task5. Need to refactor code.