improving error handling
fixing small issues
fixing the way callbacks are triggered in failure case
still trying to fix failure callback
fixing syntax error
removing unnecessary code