refactoring and add spec
Merge pull request #15 from sue445/issues/4_add_spec

refactoring and add spec at background 

close #4