Completed assignment

Functions completed and commented fully