Replaced NSNotification with delegate

Replaced NSNotification with delegate, added abstraction for SQLite and
network stuff.