fixed script to properly handle before and afetr. added control samplple. clean up script in future.