Move logic from _motion partial into helper