Changed algorithm, looks weird