Added ability to adjust margin after initial discovery phase