Compare str to str instead of str to int (oops!). Also implement logging levels.