fixing rotation code so it is only called once per frame