Simplifies code but dont fixes the bug