refactored for seneca 0.5.9