Recuresion added (perl still not working though!)