started tidying up the code. still need to put in relative path file loading for all platforms.