Various fixes and clean