Big refactoring - step 2