Split drawing function so that we can store component layers