implemented js part