Rewrote to use float comparision function