General module tidying and small fixes.