Added some debugging options and small fixes