extensive refactoring of the sliding-headers prototype
greatly reduced the complexity of the code.
added comments