Some code refactoring and commenting fun