move 'semantics' to top level