Added implementation for the programming assignment.