move demo script out of functions
code style clean-up and introducing roxygen