Rewrote in Python and rid DB dependency