Added semantics and tests