added sin and cos functions, implemented collision avoidance (unstable)