Made QNet safer.

Started to think about properly handling external optimisers to solve generic problems... I think there is a long way to go! :(