Call validation refactor

It should now be hopefully easier to spot bugs in it. Also fixed minor bug
accepting calls equal to current contract.