Added some modifications to the ui and change of algorithm