seperated forms and removed duplicate code