refining and debugging