kod gavno. working on circuit direction detection