Debugging function for js