Added code to prevent player form going out of bounds