add another implementation using list