some progress in making it modularized