type attribute can be string, int, None or a complex type, handled some edge cases