Fixes #1 - proper trigonometry