Added logging and etc