removed amiId temp variable