Code cleanup. Favourites functionaility bug fix. Fixes #41