design fixes and performance improvements in js