Born-Infeld gravity and its functional extensions