Switched to object oriented functions