cleaning up the code some