Somewhat working semantics checking

semantics checking is working in early tests should need to fix some
errors and clean up code