Some fixes and cleanup;