Added header files
Max power condition needs to be added. Rest of the algo completed