Add debug version, fix array size
Add debug mode, fix ranges