Implemented promise boilerplate