added case for 0 and changed cases for 1 and 2 to be correct