Removed unneeded argument from function
Cleaned up code and use better variable names
Use FileIO instead of passing the offset around