final fixes and cleanup