added better support for images