copying variables when creating a class