Refactored to support MVC and WebForms