Changed basic bugs and replaced if else with switch case