Refactoring
Great refactoring finished. But testing is still required