Go through your live plants and throw/ cut away anything that is mushy, dying plants will also add ammonia and the extra nutrients will promote a baterial bloom. if its an algae bloom ( green water) having some healthy aquaroum plants in there will clear it up after a fee days.
I have jar that gets direct sun for about 3 hours a day next to the window. When I first removed some plants it got cloudy, but after a week when the plants absorbed all the excess nutrients and translate that into growth, the water is now crystal clear. It remains that way regardless of how much I feed/ overfeed my fish.
If you have a test kit you can test the water to see what might be contributing to the cloudiness
4 pellets twice a day? I personally think that is overfeeding. As for the cloudiness I'm not sure what causes it but I also had trouble with cloudiness in my 5g for the first couple months. I just made sure that I did water changes every few days and made sure the fish were healthy. After a couple months of the ugly cloudiness it finally cleared up on its own and I haven't seen it come back. So the only advice I can give is keep up your water changes and wait.