background added, style improved, logic moved to js file