added functinality to log errors to messageContainer, and abstracted the writing out to keep the same autoscroll behavior in place