updated for external use