added some global variables, added more methods. corrected one error, have one more to resolve.