Cleaned up the code, alot. Also, it should use keep-alive