Updated for firefox and IE compatibility