What are the applications of second law of thermodynamics?