Improved and fixed js stuff