Implement writeAag