Further structured the code.