used cos instead of sin