Class refactoring & debug