intermediate changes
bugfixes
redesign using promises