cleaning implementation fixing bugs