tyding the code just a little