Added spring length calculation