Add rem support back to the framework - improve scale function