Added logging and configuration handling