Mid moving display logic to JS