remove bottom space
optimize function
add test unit