messing with abstracting an example taken from Java for Dummies