tidy up of dashboard code