minor fixes, efficiency gains