typecasts on initialize
refactored chained conditions