minor improvements, code cleanup