added encryption at each step