merging discover and curses scripts
add printstats function for non-graphite use
move main to a function