Tidies up some repeated code and lints