Updated to work with the native Promise interface