refactoring based on the feedback from @passy