Reorganized the code to make it more readable & user-friendly.