refactor adding with inject
make if statements easier to read