fixed off by one bug and created solve