Clean up code to get rid of groups (try again)