wrote processInputFunction and aplied some chanches in other functions