clean up software interface, do some code refactoring