First complete version of head.py