edited the head function