working on an algorethm that sucks