Redid if statements into cases. Added missing tests