refactor and comments of newform.java