modified so that encryption is not used and stage 3 can be implemented