better input parsing
lengths were incorrect