added console messages and a lot of debugging