split to three function
add method 2, doubt if useful
bug
bug