started some fxns and added globals