clean up polar view code and fix various bugs