Refactor for clearer var names. Undo testcode.