starting refactoring, putting everything inside a constructor