Make one param 'in'
Fix comments
Always use user chosen type for internal calculations

It's faster