SASS: Added in MarginFactory. (Issue #418)
Also refactored code for better classification.