Refactored modulefile