WIP - working on improved type detection