modified g and j a bit