yet another code refactor