Huge refactor, better definitions of layers and now sends a response correctly, not a json string as is