added protection and checksumming