Change 'switch' to if statements, add 'throws' to docblock