refactored few view methods into models
More refactored functions into models
added flask-cache
added external field to Images table, removed alembic