Final Programming Assignment 2 submission, with working functions