begin refactor to use promises