Import code for lab 2
Move common code into main tree