wip refactoring cleaning impementing promises