made all work with better code