Cleanup, added logging