Hlinted.
Refactored : put every db call in a method.