Refactoring

- function-ized some code blocks
- changed lot of "Staff" to "System"