Refined the ami creation