finished ast implementation