Refactor: move control handle to js file