First crack at preprocessing

Re. #1