hw2 basic functionality