Javascript working rough draft