is there another way of solving this?