Restructure package layout, re-factor redundant logic