Make environment agnostic so it can run in the browser