Moved code to get classes from 'server' (json) to its own factory.