implemented input parsing