refactored into commandline application