Big cleanup, plus better handling for 1.5.x libraries