Fix namespacing bug.
Prefer core fns to custom ones & minor style fixes.