Renamed canvas references to 'ctx' and added a path smoothing option.