better modularity through javascript