Small refactor, code reorganization
Merge branch 'refactor'