Cleaned up remote/library folder management code