added alternate implementation