move mod to Native.Basics, improve style, remove dead code