Updated/refactored to improve semantics and usability