moved most of form creation from html to js