bind log to log variable
move group creation inside its own function