Cleaned up main module