a more organized version