Fixed things and changed to use header files