Added math round for optimization + bugfix