Did some stuff here
Added database support.
The glitch right now is the fact that the program runs for too long to terminate.