Bugfix and formatting