Factor resources out of main class
Tidying up