Client-side magic

Baby steps trying to get the client-side magic to work like it should
with no dependencies on jquery.