located and fixed (I hope) several pahntom bugs (see todo for details)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
did some cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>