Re-organizing the code