Decoupling js and page