remove unnecessary whitespace and add generic types