refactor hand over to deal with multiple asynchronous requests better

Squashed commit of the following:

commit 0e30a22a408d9f7cd907592db3a5c47713136f3d
Author: Matus Kmit <matus.kmit@zhdk.ch>
Date:   Wed Jun 25 17:32:53 2014 +0200

    done callback for multiple asynchronous ajax requests