Added basic UI elements, little change in the algorithms.