Devoncarew refactor app

Some refactorings in support of moving to a more standard package file format for the app (so, lib/, web/, test/, ...). Basically, de-couple code in app/lib from referencing code in app/.

@umop