Code Rewrite

Complete and total rewrite of the base code. Got tired of not knowing
what I was coding.