gets() done and some bugs fixed