Close #6. Refactor loop class