Add some typespecs
Fix "negative" handling (like "-1", "-count(node)" etc)