more succinct code with less duplication