use slice to make loop more concise per peterbe