Code improvements, to make sure it works with Search API