refactored to account for floats