fixed wrong class name.
refactored if conditions. very complicated.