moved object naming into if statements