refactor code, make result clickable