Better implementation of AMX APIs