Better way to handle client and server side sharing of code