First implement the 8-bit code.
Later if you are confident the 4-bit code is easy.
You need to save the second nibble and process that as first.
You have to reset your LCD 3 times if i remember correct, so on restart it will be good.
Dont use read mode ever, and use long delays first until your code is working to be sure.