using promise instead of callbacks, work in progress