altered some code for images