Organize module imports. Fix bug when disabling encryption. Cleanup.