Cleanup and general improvements