Did more refactoring. Added log4j2 for logging.