Cleaned up main script. Using gfx.js