added proper indentation and tab and also removed globalization of variables