Start moving to new liberation model and tidy up lib code