fclose proper
changed getting categories into a function, to return the categories array
added the get categories as a class method
test successful, just some slight modifications required