Some rearangement of code, minor change