Refactor inline js