First part of assignment 3 implemented