fixes #2, rearranging middleware and using catch all routing