data frame is now returned instead setting it globally
Made helper functions private
Minor function rename
Removed whitespaces in variable names