refactor sol.
add comments.