almost finish all process and need to be modified more easy to read