Fixed bug in calculations and added bench task.