Added logging using log4j2 and fixed some style.