Storing as array
Moving callback into class
adding type hinting instead of casting on output