Initialization of variables should not be part of renderElements. Maybe use a explicit initialization function or some sort of constructor.