-- Restructured the code