Successfully re-structured the code.