add @before and @after statements, among some syntax corrections