Just how will I solve this mess of code.