Restructure and Change coding style