code refactor -- improved readability