changing code for creating from existing