Fixing stylesheet caching once and for all hopefully. Changed some ordering, simplified the monstrous if statement and fixed issues with paths.