add docstings; include profiler (but not using it yet)