added some js and improved authentication