SMS: Algebra and logic