lab 4 with all working functionality