writing pseudocode for forms and refactoring