Functions of bounded variation and free discontinuity problems