tidy some code