Move JS into module pattern