cleaned up main module