I suggest that you try something like this. I also added a variable "x velocity" for smoother movement on ground.