full version of bad code