20 issues solved plus refactoring

I have made major improvements in the organization of the files and
solving some of the many issues that I detected in the project.  This
version is almost right for most of the cases (2 tests need to be
finished still).