Added tests; Tweaks and reorg