head functionality done with test cases