Fixed PEP8 and fixed detach_subs func