replace ap with puts