cleaning up the client facing js, still hideous