refactored z-index stuff