modules, if else and scope of variables