moved type global definition to the top

Allows for more generic type definitions and easier maintenance down the
line