added better end-user interface and top func