pattern algo is maybe kinda working?