first working version, no command-line functionality