refactored, added layouts deletion functionality