Changed poly fitting + some inside code