What is the purpose of bail and why is it granted?