Reverted back to using doubles, but kept the other changes