add checkbox and refactor