Added image generation and calls to database