After much debugging!