Added performance test
Some minor bugfixes