Added image size checking (commented out)