Removed querying database twice

Changed:
generate_data executed database query twice if fields were provided.
Now it only does this once.
Merge pull request #11 from samastur/master

Removed querying database twice