cleaned up test and train set code