Extended theory of gravity