Added more type checks