Cleaned up images code