feature detection and some corrections on layout