07/11/14 ai modified so it could be used for pre & post data. also cleaned up