Bugfixes from testing + a few general improvements + added derby dependency