Refined structure. Coded javascript approach.