minor edits and removed min