Fix float classcastexception
Refactor structure