fixed border detection
haddock cleanup