edits
refactored from literatte