improvement and debugging