refactor web code