Updated to accept both url and file