More work + add debugging stuff everywhere