refactor permalink module