started work on cleaning debug. More work on promise tidying.