Refactored code to replace if conditions with dict objects

Felt it'd be nicer with lesser ifs. I still hope to contribute more in my free time