Debugging
Added safety code