Transparent render fix, and some code cleanup