Fixed debug functionality
Refactoring skeleton and texture drawing code