removed buggy switch case flow control