Add possibility to save and load trained networks, update tests