removed unnessecary declarations
fixed bug where n were shadowed
added default to switch-statement