Tidied up code, separated globals from constants and groups