adding a DAO layer and separating JS files