feat: added configurable checkpoints history

added configurable checkpoins history, to avoid growing the size of database, bugfixes, pep8