refactor code
optimize