rewrite as amd module