Bugfix and reformatting