Removed unnecesary switch and added logging