removed duplicate code by merge