shortened if/elses and string replacement