removed overwrite and cleaned up some code