(WIP) still refactoring code