Throw exception for basepath errors, and support dynamic basepaths.
Added trait for singeltons.
Added canvas class.