Some serious refactoring + use Gaufrette rather than custom streamwrapper, cleanup