added possibility to add, remove and list units. some code refactoring