Minor refactoring, basic form functionality