refactor and edits