de-globalised aql
shortened internal aql function names
removed dead code