Add logging, create statedir, check for shennanigans