reorganize js and created an engine that draws