New version of the brain application

Here's the final commit for my work. I hope you find it in good enough condition to be extended in the future. Thanks Tim!