better way to generate score