Some minor fixes and cleanup