added departments and some functionality