Added scaling. Fixed some outstanding issues.