Fix issue with empty lines and improve error handling
before now, the package will panic if it detects a recursion, this behavior has been changed to just an error being returned
before now, the package will panic if it detects a recursion, this behavior has been changed to just an error being returned