Follow programming guidelines.
Code rearranged in methods for readability