standardize REST class
Add debug mode