switching if statements over to dictionary lookup