Added logging
Cleaned up