Further input imporvements

Added some global variables and fixed some input related issues.