Algorithm and GUI improvements