Refactor formatting and mounting logic