Restructure code dealing with potion effects