added code for keeping boxes checked