Fixed panels rendering bugs and removed redundant codes.