Small refactorings & migration script extended

 
 - combined two methods to get: resourceNamed
 - changed field back to function
 - migration script now removing obsolete state field