Moved some definitions around in ast to make it work