Perhaps a better way to prevent messy code?