Changed to url style action name (keep-alive => /keepalive)
Moves some code into separate functions.