Cleanup & bugfix