General and DAO refactorings.

 - Tabs replaced by spaces
 - Optional type used to wrap nullable returns