more refactoring, added loop class