added  instance variable, new methods; fixed compile errors