implementing closure with grunt and requirejs + refactoring