start of refactor to use promises