Refactor declare.ls into a more modularised structure.