Refactor messages; Add model layer.