Algo finally working