added if statement to limit pictures