refactored code for comments on question/answer