improved calculations, implemented active find corner