added input filtering