minor edits moving code to one place