fixing bugs and doing grounding implementation