changed layouts and fixed formatting. removed and reorganized functions