Refactor course form JS