Changed template structure, added AJAX calls and server side code to handle these calls