Added implementation of DAO, minor changes