polar function now works