improve namespacing and extract lambda