reformat some code
add expand() fix #345