added peak detection and improved node recognition