Modified to work with servlets