better debug
code rearrangements
rewrite