list function  works well and code format is not  so well