Final version for assignment
Updated with comment corrections