Moved some types out of class code to make it clearer