refactoring the structure (unfinished)