Fine tuning some parts of the code
Lots of tweaks and inconsistencies fixed