better code for setting score