Added prepareenv