modularize code, add custom panel for graphics