Fix contracts. Clear layouts and activity