use instance variables instead of globals
use built in enumerable find methods. raise execptions for errors