- Fixed a bug with loading tabs when there is library locations

- restructure code