Refactored method execution in tornado.web

Refactored the part that executes the method, so it can be easily overwritten.