refactor: move umount to a separate function