correct type parsing
some formatting improve