refactored code, fixed bug when clicking from user show page