more refactoring to separate re-usable stuff from demo web site