Refactored for better live use