Code cleanup - first pass
Code cleanup - second pass
Made code more readable