Cleaned up semantic_check