refactored to logging with log4js