Major Simplification and seems to still work fine