Remove magic number

Support any ratio and remove magic number.