Updates logging and fixes bugs