Fix collectgarbage

Converted String switch case to if statements