refactored logging to log4j (partially)