Added code for objects that move back and forth in a line