Completed optional exercises for ML assignment #5