Refactor to allow group variables