a few cosmetic changes
Totally rework logic