Added scaling. It's a bit messier than I'd like: I'm dividing elementwise by a matrix as I can't find the method for dividing by a scalar.
Added results for each demo-ing.