convert to using Promises

could still use a lot more refactoring, but this makes the pipeline clearer in some ways