applied some minor improvements