refactor beforeFilter stuff as run; fixed username check