Cleanup and fixes