Reworked multiple var statements and reduced duplication

The multiple var statement was hard to read on such a long line, also set cursor and line variables to defaults as there was a fair amount of duplication throughout the following switch statement.