Some debugging and cleanup