Proper logging, some cleanup