Removed some debug calls
Refactored