Sort: Refactor js into proper place