Got rid of locals from functions
old merge