This is cool. One error in using sorted instead of inplace list.sort() method
was causing all trouble.