Updated main.lua

Correct calculation of current measure. Fixes, comments.