Redraft of code

New design and updates detailed in Update 4/22/2013 section of plans.