Changed method to friend functions