Make cleanQuery run after middleware

Needed to fix #53

Signed-off-by: Ian Macalinao <me@ian.pw>