hopefully, working refactored version