modified both simple and advanced keypad code