Refactor and comment