Converted to pass by reference in methods instead of pass pointers