Basically, your dig5 is inside dig4 that is inside dig3 ... That is what embed means.
You need to put the 'end' for each function before you start the next one.
By the way, do register on pastebin, it lets you edit the content when you manually put it there, so just edit the pastebin directly...