List lookup to actual math

"Replaced var/sizes_to_number with weirdass formula that is faster and takes up less space in code than list lookups"

Affected code are all from 5cfa0df3d29a2f631e16e7ee0cc24ab9ca3fe566