Some refactoring. First pass at nTray. Fixes #6.