Made debug into a function, changed test page