Refactor web application code