Refactor

Tidied up code on dashboard