big clean up of compile code, works now except save() is not implemented