Added license and reformatted the code.