Update on lex.cpp, lex.h and main.cpp

Some changes and method definitions are made.