Slightly refactored daos and logging logic.
Cleaned up js controller.