coded all 3 parts of availability screen backend