convert more code to use promises
covert more code to use promises