display score in gui and minor improvements to code