Some fixes, cleanup