Add validate checks, fixes #25

Return an empty array if line is out of bounds.
Remove unused variables.