More altering of layouts. Fixed bug when closing secondary instance of the program.