working on semantic checking. Redesigning almost everything

Merging KC's changes back into master