Modal window code, global variables, some style/structure, and user functions