Rewrote to use Slim and templates