Refactoring + architecture notes