changed token access method from file to database