clean up and incorporate code feedback