Fixed errors and added egress button code