changed variable name and some fixes