code cleanup and modulefile fix