Litedown: reorganized some code. No functional change intended