added user interface, replaced some functions