eliminated duplicate code