implemented device api, added DAL, fixed bugs with app