fix global variables & code commented