Type fixed
some improvement and additions