adding in functions to take care of the x-axis overflow