Added lotsa debug functions