First Re-factor attempt

first attempt at re-factoring code for new sdk to produce a running
version