A little refactoring

Reorganized, removed redundant code. Also imposed programatic access strictness.