agent refactor to make it more mootools like