code refactoring.
data preparation code separated.