Changed int to double (still need to add scaling routine)