Add GUI, finish algorithm