Refactored some redundant code.

- typedef needs to be done in a header file.