cleaning up and putting much better code in. Step 1 of 2