Form JS refactoring