refactoring
refactirong, fixed #5, fixed #3