refactor code due to coment