Rewrote Javascript to Module