restructuring the code
fixing it