change to use Data.List.partition