added factories
removed duplicated code on modals