Assignmenet 3: finished basic functionalities