Adding debug functions and fixing grammar issues