Adding indexes to activity model to speed up login and fix #288