changed print function, added compare function