move the mount_directory function to a separate source file