Moved out a helper method to debug