Wow, this code is all interesting, could you explain this black magic?