Massive cleanup and changes