Reworked request handler

This closes #41