reduced logic down to one place