Various (much needed) cleanups