restructured code, changed starting ami