Adding options for keys and provider and cleanup for images function