cleaner implementation which uses syntax tables correctly