see if this fixes some of the commit. Could be optimized more