started working on availbilty checking and database updating