use before block instead of define method