titied up the code some