Implemented toRaster function in classes

`} else {` looks better IMO. Should be an easy search and replace.