Merge pull request #39 from yogthos/master

cleaned up middleware app-handler
improved check for rule redirection