Trying to make it more efficient

Working with `case when`, when possible, I'm using hash tables -> faster then using case or if.
Directing exception handling for more direct types of exceptions (still long way to do it).

There is a need for a more efficient way to write to a file, I'm thinking in two different ways, still not sure about it.