Structure cleaning

Cleans up functions and generic types.