Bugfixes and better formatting