Refactor for a more functional style and less static.