switch cos and sin
added first version
works a bit better now