Minor refactoring, added detection of hlines