Fixes after @fredrikpersson's review