created example using promises pattern