refactoring for clarity
commenting code for readability