Added logging. Added some warnings.