a few enhancements
merged with head