Added co-ordinate rotation function instead of inline rotational code