Fixed small type declarations bug from previous commit and tidied up