A - Restructured the code