Added optional output argument