use proper typed method
make debug configurable