made code more object-oriented. imported code for modals