Re-wrote code with simpler JS to reduce mark-up in HTML page