Some refactoring, also changed unfinished distance storage system and rewrite SQLiteHelper class