added max length over which to search for peaks