rebuilt, updated to be cleaner