started working on maching algo