Remove unused code and fix After block