Major refactoring to clean everything up

At this point we still have recursion issues, so stuff won't
compile. Goal is to fix that in the near future.