Refactor order js