updated with debug