Bug fix and changing double to float