added preprocessing and updated interface