moved code to generators