589 Added sorting of modules for position before rendering