Add ratio parameter
Fix rounding error
Change up some constants