Refactoring + basic structure