modified to work better in browsers and server side"