Fixed bug, function now works on all lines