minor refactoring
extracting method
adding basic integration test