minor fixes. shortened code