better error management.
Used regular expressions a lot more.
cleaned the code.