Faster loading and global caching

Signed-off-by: Vaclav Vancura <vaclav@vancura.org>