WIP - adding cycle checking and type hashing