added serialization
added checks