Calling class function properly