made changes to karma calculated code