Fixed sqlite caching, and added alternate layout for portrait mode