refactored access module code