Clean up some functions to use angular's methods (for checking if a var is a function)
Added function for determining if a deferred object should be rejected or resolved based on a returned status value.