simplify and enhance links parsing (solves #29)