Fixed restore functionality. Added service tests. Minor fixes