added init functionality to js