Implementing insertAtHead function and unit tests