Might want to replace all this with a case statement.